<ion-view view-title="团购" class="myworld_sale">

	<ion-content scroll="false">
		<div class="row text-center padding-0 font-large-my">
			<div class="col" on-tap="activeSlide(0)" ng-class="selectIndex==0?'top-activated':''">
				<img src="img/group1.png" /><br /> 活动设置
			</div>
			<div class="col" on-tap="activeSlide(1)" ng-class="selectIndex==1?'top-activated':''">
				<img src="img/group2.png" /><br /> 团购商品
			</div>
			<div class="col" on-tap="activeSlide(2)" ng-class="selectIndex==2?'top-activated':''">
				<img src="img/group3.png" /><br /> 团购对象
			</div>
			<div class="col" on-tap="activeSlide(3)" ng-class="selectIndex==3?'top-activated':''">
				<img src="img/b4.png" /><br /> 团购红包
			</div>
		</div>

		<ion-slide-box delegate-handle="main-handle" on-slide-changed="slideChanged(index)" active-slide="slideIndex" show-pager="false">

			<ion-slide>
				<ion-scroll direction="y" ng-style="myObj" lazy-scroll>
					<!--描述：下拉刷新-->
					<!--<ion-refresher pulling-text="下拉刷新..." on-refresh="doRefresh()"></ion-refresher>-->

					<!--不能引入外部页面，因为这里要求可输入的，而外部文件是不可输入的-->
					<!--<div ng-include="'templates/myworld/sale/activitysetting_tem.html'"></div>-->
					<div class="list">
						<li class="item text-center" style="color: black;">
							发起营销活动（团购）
						</li>
						<li class="item item-input">
							<span class="input-label">
                           	   	     活动名称：
                           	   	 </span>
							<input type="text" placeholder="请输入活动名称" ng-model="scope.name" />
						</li>
							</li>
						 <li class="item item-input" ion-datetime-picker title="'请输入开始时间'" ng-model="scope.start_time">
				<span class="input-label">开始时间：</span>
				<input type="text" placeholder="请输入开始时间" class="timeLight" ng-class="{'timeNoneInfo':scope.start_time}">{{scope.start_time| date: "yyyy-MM-dd H:mm:ss"}}</input>
			</li>
			<li class="item item-input" ion-datetime-picker title="'请输入开始时间'" ng-model="scope.end_time">
				<span class="input-label">结束时间：</span>
				<input type="text" placeholder="请输入结束时间" class="timeLight" ng-class="{'timeNoneInfo':scope.end_time}">{{scope.end_time| date: "yyyy-MM-dd H:mm:ss"}}</input>
			</li>
			<li class="item item-toggle">
							临时群
							<label class="toggle toggle-positive">
				             <input type="checkbox" checked="" ng-model="scope.create_group">
				             <div class="track">
				               <div class="handle"></div>
				             </div>
				           </label>
						</li>

						<li class="item item-toggle">
							自动红包
							<label class="toggle toggle-positive">
				             <input type="checkbox" checked="" ng-model="scope.has_packets">
				             <div class="track">
				               <div class="handle"></div>
				             </div>
				           </label>
						</li>
						<li class="item item-input">
							上传图片：
							<div class="file-show">
								<div class="add input-file" ng-repeat="img in scope.image" style="overflow: initial;">
									<div style="position: absolute;margin-left: 1.5rem;margin-top: -1.0rem;font-size: 1.0rem;color: #333333;" on-tap="ondelete($index)"><i class="icon ion-close-circled"></i></div>
									<img style="width: 100%;height: 100%;" src="{{img.image}}">
								</div>
							</div>
							<div class="add input-file" on-tap="doShowFile()">
								<span class="icon ion-plus"></span>
							</div>
							<input id="upfilebutton" type="file" multiple="multiple" accept="image/*" onchange="angular.element(this).scope().onupload(this)" style="display: none;" />
						</li>
						<div class="item item-input item-select" data-tap-disabled="true" style="padding:0 30px 0 15px;">
							<div class="input-label">品牌：</div>
							<div class="input-value" ng-click="doSelectBrand()">{{input.brand.name}}</div>
						</div>
						<div class="item item-input item-select" data-tap-disabled="true" style="padding:0 30px 0 15px;">
							<div class="input-label">品类：</div>
							<div class="input-value" ng-click="doSelectCat1()">{{input.cat1.name}}</div>
						</div>
						<div class="item item-input item-select" data-tap-disabled="true" style="padding:0 30px 0 15px;">
							<div class="input-label"></div>
							<div class="input-value" ng-click="doSelectCat2()">{{input.cat2.name}}</div>
						</div>
						<div class="item item-input item-select" data-tap-disabled="true" style="padding:0 30px 0 15px;">
							<div class="input-label"></div>
							<div class="input-value" ng-click="doSelectCat3()">{{input.cat3.name}}</div>
						</div>
						<li class="item item-input-inset item-icon-right" ng-repeat="cat in scope.cat_type">
							<span ng-class="{invisible:$index>0}">已选品类：</span> {{cat.name}}
							<i class="icon ion-close-circled assertive " on-tap="delete_type($index)"></i>
						</li>
					</div>

					<div class="button-bar padding">
						<button class="button  button-assertive">取消</button>
						<button class="button  button-positive col-offset-10" on-tap="submit()">保存</button>
					</div>

					<!--描述：当用户到达页脚或页脚附近时-->
					<!--<ion-infinite-scroll ng-if="!isLoad" immediate-check="false" on-infinite="doRefreshMore()" distance="1%"></ion-infinite-scroll>-->
				</ion-scroll>
			</ion-slide>

			<ion-slide>
				<ion-scroll direction="y" ng-style="myObj" lazy-scroll>
					<!--描述：下拉刷新-->
					<!--<ion-refresher pulling-text="下拉刷新..." on-refresh="doRefresh()"></ion-refresher>-->
					<div class="item item-borderless padding-10 text-center">关联商品 <span class="right-zhang positive" on-tap="openGoods()">添加商品+</span></div>

					<div class="padding-5  light-bg">
						<table border="1" cellpadding="0" cellspacing="0" width="100%">
							<tr>
								<td width="30%">商品名称</td>
								<td width="17%">价格</td>
								<td width="17%">定金</td>
								<td width="17%">数量</td>
								<td width="19%">起购数</td>
							</tr>
						</table>
						<table border="1" cellpadding="0" cellspacing="0" width="100%" ng-repeat="goods in datas.goods">
							<tr class="font-gray-my">

								<td on-tap="detailChanged(goods.goods_id)" class="positive" width="30%">{{goods.goods_name}}</td>
								<td width="17%"><input/ type="number" style="width: 100%;" ng-model="goods.price"></td>
								<td width="17%"><input/ type="number" style="width: 100%;" ng-model="goods.deposit"></td>
								<td width="17%"><input/ type="number" style="width: 100%;" ng-model="goods.count"></td>
								<td width="19%"><input/ type="number" style="width: 100%;" ng-model="goods.least_buy_num"></td>
							</tr>
							<tr ng-show="detailContent[goods.goods_id].checked">
								<td colspan="5" style="line-height:10px;border: none;"><img src="img/trangle.png" /></td>
							</tr>
							<tr class="font-gray-my stable-bg" ng-show="detailContent[goods.goods_id].checked">
								<td colspan="5" class="assertive">团购详情
									<i class="icon ion-ios-plus-outline positive font-1rem-my right-zhang padding-right" on-tap="add_goods_rule(goods.goods_id)"></i>
								</td>
							</tr>
							<div>
								<tr class="font-gray-my stable-bg" ng-show="detailContent[goods.goods_id].checked" ng-repeat="rule in goods.groupbuy_rule">
									<td><input type="number" placeholder="请输入数量" class="text-center" ng-model="rule.count">件</td>
									<td colspan="2"><input type="number" placeholder="请输入时间" class="text-center" ng-model="rule.days">天</td>
									<td colspan="2"><input type="number" placeholder="请输入价格" class="text-center" ng-model="rule.promotion_price"></td>
								</tr>
							</div>
							<tr ng-show="detailContent[goods.goods_id].checked">
								<td colspan="5" style="line-height:10px;border: none;">&nbsp;</td>
							</tr>
						</table>
					</div>

					<div class="button-bar padding">
						<button class="button  button-assertive">取消</button>
						<button class="button  button-positive col-offset-10" on-tap="save_goods_rule()">保存</button>
					</div>
					<!--描述：当用户到达页脚或页脚附近时-->
					<!--<ion-infinite-scroll ng-if="!isLoad" immediate-check="false" on-infinite="doRefreshMore()" distance="1%"></ion-infinite-scroll>-->
				</ion-scroll>
			</ion-slide>

			<!--团购对象-->
			<ion-slide>
				<ion-scroll direction="y" ng-style="myObj" lazy-scroll>
					<!--描述：下拉刷新-->
					<!--<ion-refresher pulling-text="下拉刷新..." on-refresh="doRefresh()"></ion-refresher>-->
					<div class="item">
						授权中心列表
						<span class="right-zhang positive" on-tap="openSpec()">添加授权中心+</span>
					</div>

					<div class="list" ng-repeat="store in datas.store">
						<li class="item" style="padding: 6px 10px 5px 16px;">
							{{$index+1}}、{{store.store_name}}
							<span class="bian_red assertive right-zhang" style="padding: 0px 5px;" on-tap="delete_store(store.store_id)">删除</span>
						</li>
						<li class="item item-input-inset">
							<div class="input-value small" ng-click="doSelectProvince(store)">{{store.province.name}}</div>
							<div class="input-value small" ng-click="doSelectCity(store)">{{store.city.name}}</div>
							<div class="input-value small" ng-click="doSelectDistrict(store)">{{store.district.name}}</div>				
							<i class="icon ion-plus-circled positive font-1rem-my" on-tap="region_choose(store.store_id)"></i>

						</li>
						<li class="item item-input-inset item-icon-right" ng-repeat="region in store.region">
							<!--已选区域：江苏-南京-xxx区-->
							<span ng-class="{invisible:$index>0}">已选区域:</span>&nbsp;{{region.region_name}}
							<i class="icon ion-close-circled assertive " on-tap="region_delete(store.store_id,$index)"></i>
						</li>
						<li class="item item-toggle">
							是否允许改价：
							<label class="toggle toggle-positive">
				             <input type="checkbox" checked="" ng-model="store.change_price">
				             <div class="track">
				               <div class="handle"></div>
				             </div>
				           </label>
						</li>
					</div>
				</ion-scroll>
			</ion-slide>

			<!--团购红包-->
			<ion-slide>
				<ion-scroll direction="y" ng-style="myObj" lazy-scroll>
					<!--描述：下拉刷新-->
					<!--<ion-refresher pulling-text="下拉刷新..." on-refresh="doRefresh()"></ion-refresher>-->
					<!--引入外部的文件-->
					<div ng-include="'templates/myworld/discount/promotionredbag_tem.html'"></div>
					<!--描述：当用户到达页脚或页脚附近时-->
					<!--<ion-infinite-scroll ng-if="!isLoad" immediate-check="false" on-infinite="doRefreshMore()" distance="1%"></ion-infinite-scroll>-->
				</ion-scroll>
			</ion-slide>

		</ion-slide-box>
	</ion-content>
</ion-view>